{% load static %}
<!DOCTYPE html>
<!-- saved from url=(0031)http://ws.gjingxi.com/qr_login/ -->
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>扫码登录</title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="{{ STATIC_URL }}frontend/css/impowerApp29579a.css">
    <script src="{{ STATIC_URL }}frontend/js/jquery.min.js"></script>
</head>
<body style="background-color: rgb(51, 51, 51); padding: 50px;">
<div class="main impowerBox">
    <div class="loginPanel normalPanel">
        <div class="title">扫码登录</div>
        <div class="waiting panelContent">
            <div class="wrp_code"><img class="qrcode lightBorder" src="{% url 'qs' key %}" id="qrcode">
            </div>
            <div class="info">
                <div class="status status_browser js_status normal" id="wx_default_tip">
                    <p>请扫描二维码登录</p>
                </div>
            </div>
            <div class="status status_succ js_status" style="display:none" id="wx_after_scan">
                <i class="status_icon icon38_msg succ"></i>
                <div class="status_txt">
                    <h4>扫描成功</h4>
                    <p>请在中点击确认即可登录</p>
                </div>
            </div>
            <div class="status status_fail js_status" style="display:none" id="wx_after_cancel">
                <i class="status_icon icon38_msg warn"></i>
                <div class="status_txt">
                    <h4>您已取消此次登录</h4>
                    <p>您可再次扫描登录，或关闭窗口</p>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    !function () {
        function a() {
            $.ajax({
                type: "GET",
                url: "/api/qrlogin/{{ key }}/check/",
                cache: false,
                dataType: 'json',
                timeout: 2000,
                success: function (data) {
                    console.log(data.status);

                    switch (data.status) {
                        case 'done':
                            window.location.href = '/api/qrlogin/{{ key }}/done/';
                            break;
                        case 'cancel':
                            $(".js_status").hide();
                            $("#wx_after_cancel").show();
                            setTimeout(a, 2000);
                            break;
                        case 'scan':
                            $(".js_status").hide();
                            $("#wx_after_scan").show();
                            setTimeout(a, 2000);
                            break;
                        case 'timeout':
                        {#                            $('#qrcode').attr('src',data.key);#}
                            window.location.reload();
                            break;
                        case 'init':
                            setTimeout(a, 2000);
                            break;
                    }
                }

            })
        }

        var b = window.top != window;

        if (b) {
            var c = "";
            "white" != c && (document.body.style.color = "#373737")
        } else {
            document.getElementsByClassName || (document.getElementsByClassName = function (a) {
                for (var b = [], c = new RegExp("(^| )" + a + "( |$)"), d = document.getElementsByTagName("*"), e = 0, f = d.length; f > e; e++) c.test(d[e].className) && b.push(d[e]);
                return b
            }),
                    document.body.style.backgroundColor = "#333333",
                    document.body.style.padding = "50px";
            for (var d = document.getElementsByClassName("status"), e = 0, f = d.length; f > e; ++e) {
                var g = d[e];
                g.className = g.className + " normal"
            }
        }
        var h = "";
        if (h) {
            var i = document.createElement("link");
            i.rel = "stylesheet",
                    i.href = h,
                    document.getElementsByTagName("head")[0].appendChild(i)
        }

        setTimeout(a, 2000);
    }();
</script>
</body>
</html>